package com.dhms.vostok1.data.fault

import com.dhms.vostok1.data.BasePageQueryData
import com.dhms.vostok1.data.DEFAULT_PAGE_LIMIT
import com.dhms.vostok1.data.DEFAULT_PAGE_OFFSET
import com.dhms.vostok1.data.PrimaryBaseListData
import com.squareup.moshi.Json

/**
"_id": "62c3d961b0d466248ed1ebc8",
"fault_id": 25671,
"fault_types": [
"207"
],
"device_id": 1066,
"device_name": "测试设备",
"device_category_cu_id": 450,
"device_category": 10001,
"device_responsible_id": 551,
"metric_no": "m.6027",
"metric_name": "振动加速度",
"cp_id": 2310,
"cp_name": "1#电机驱动端",
"value": "17.428",
"vib_file": "http://vib.prod.dhms.net/1066/m.6027/1066-m.6027-2022-07-05T14-25-07.gz",
"wave_file": "http://vib.prod.dhms.net/1066/m.6027/1066-m.6027-2022-07-05T14-25-07.gz",
"conclusion": "电机轴:轴系未见异常\n电机驱动端轴承:推测该轴承或所在轴系的另一未知品牌型号的轴承外圈或滚动体存在缺陷\n",
"suggestion": "电机驱动端轴承:请现场核实轴承有无异响，停机时检修确认故障\n",
"report_url": "https://dhms-image.oss-cn-beijing.aliyuncs.com/26557de_284f2879-c743-4fb7-a962-b67b0f8c4364.pdf",
"part_state": [
{
"part_id": "e6a63811-f6a1-460b-a548-9f00371ffefb",
"part_name": "电机驱动端轴承",
"part_type": 200002003,
"part_type_name": "滚动轴承",
"is_fault": true,
"fault_type": [
"207"
],
"suggestion": "请现场核实轴承有无异响，停机时检修确认故障",
"conclusion": "推测该轴承或所在轴系的另一未知品牌型号的轴承外圈或滚动体存在缺陷"
}
],
"org_id": 1000000000000284,
"org_name": "科大王因车间",
"record_type": "AUTO",
"fault_status": 2,
"handle_status": 1,
"handle_elapse": 0,
"fault_occurred_time": "2022-07-05 14:25:07",
"thresholds": "1,2,3,4",
"updated_at": "2022-07-05 14:25:37",
"created_at": "2022-07-05 14:25:37"
 */
data class DiagnoseListItem(
    @Json(name = "part_state")
    var partState: List<PartState>?
)

data class PartState(
    @Json(name = "part_id")
    val partId: String?,
    @Json(name = "part_name")
    val partName: String?,
    @Json(name = "part_type")
    val partType: Long?,
    @Json(name = "part_type_name")
    val partTypeName: String?,
    @Json(name = "is_fault")
    val isFault: Boolean?,
    @Json(name = "fault_type")
    var faultType: List<String>?,
    @Json(name = "suggestion")
    val suggestion: String?,
    @Json(name = "conclusion")
    val conclusion: String?
)

data class FaultDiagnoseQueryData(
    @Json(name = "fault_id") var faultId: Long,
    @Json(name = "per_page") override var limit: Int = DEFAULT_PAGE_LIMIT,
    @Json(name = "page") override val offset: Int = DEFAULT_PAGE_OFFSET,
) : BasePageQueryData

typealias DiagnoseListResData = PrimaryBaseListData<DiagnoseListItem>